package com.ep.modules.app.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ep.common.utils.PageUtils;
import com.ep.modules.app.dao.AppDataBackupLogMapper;
import com.ep.modules.app.entity.AppDataBackupLog;
import com.ep.modules.app.entity.AppDataBackupLogExample;
import com.ep.modules.app.service.AppDataBackupLogService;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppDataBackupLogServiceImpl implements AppDataBackupLogService {
    @Autowired
    private AppDataBackupLogMapper appDataBackupLogMapper;

    public PageUtils queryPage(Map<String, Object> params) {
        String searchKey = (String)params.get("searchKey");
        Long searchUserId = (Long)params.get("searchUserId");
        AppDataBackupLogExample example = new AppDataBackupLogExample();
        AppDataBackupLogExample.Criteria criteria = example.createCriteria();
        List<AppDataBackupLog> list = appDataBackupLogMapper.selectByExample(example);
        Page<AppDataBackupLog> page = new Page<>();
        page.setRecords(list);
        return new PageUtils(page);
    }

    public AppDataBackupLog getById(Long id) {
        return appDataBackupLogMapper.selectByPrimaryKey(id.intValue());
    }

    public void save(AppDataBackupLog entity) {
        appDataBackupLogMapper.insert(entity);
    }

    public void update(AppDataBackupLog entity) {
        appDataBackupLogMapper.updateByPrimaryKeySelective(entity);
    }

    public void deleteBatch(Long[] ids) {
        for (Long id : ids) {
                appDataBackupLogMapper.deleteByPrimaryKey(id.intValue());
        }
    }
}